<!--
 * @Author: YTian
 * @Date: 2023-05-19 14:51:16
 * @LastEditTime: 2023-05-20 09:56:37
 * @Description: 歌手详情
 * @FilePath: \pcsong\src\views\singer\Singer.vue
-->
<script setup>
// ========= 导入全局api ========= //
import { api_artists } from '@/global/api.ts'

// ========= 导入vue api ========= //
import { onActivated, ref } from 'vue'

// ========= 导入详情组件 ========= //
import Details from '@/components/Details.vue'

// ========= 导入路由 ========= //
import { useRoute } from 'vue-router'

// & 获取路由对象
const route = useRoute()

let id = route.query.id

let artists = ref(await api_artists(id))

onActivated(async () => {
	let temp_id = route.query.id

	if (id !== temp_id) {
		id = temp_id

		artists.value.details = {
			cover: '',
			name: '正在获取~',
			description: '暂无'
		}

		artists.value.links.splice(0)

		artists.value = await api_artists(temp_id)
	}
})
</script>

<template>
	<Details :introduce="artists.details" :song__list="artists.links" />
</template>

<style scoped></style>
